package com.yinhanshi.s3test.sign;

import android.content.Intent;
import android.view.View;

import com.yinhanshi.s3test.http.ApiRetrofit;
import com.yinhanshi.s3test.http.BaseResponseBean;

import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * 标题：安全令牌管理类
 * 作者：yinhanshi .
 */
public class SignManager {

    /**
     * 获取文件上传所需安全令牌
     */
    public String getSignUrl(String fileKey, long fileSize) {
        ApiRetrofit.getInstance().getSignedUrl(fileKey, fileKey)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<BaseResponseBean>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(BaseResponseBean responseBean) {

                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });

        return fileKey + "&" + fileSize;
    }

}
